//浅拷贝
#include <iostream>
using namespace std;

class A
{
    char *p;
public:
    A(){p = new char[100];}
    ~A(){delete [] p;}
};

int main(int argc, char const *argv[])
{
    A *p1 = new A;

    A *p2 = new A(*p1);

    A *p3 = new A;
    *p3 = *p1;

    delete p1;
    //delete p2; //重复释放堆内存

    //浅拷贝只能拷贝指针，并不能拷贝指针所指的内存

    // A a;
    // A b(a);//拷贝构造，浅拷贝
    // A c;
    // c = a;//赋值操作，浅拷贝

    return 0;
}
